﻿<UserControl x:Class="BloggerAutoPoster.Shell.Views.ConfigUc"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
             xmlns:Behaviors="clr-namespace:BloggerAutoPoster.Common.Behaviors;assembly=BloggerAutoPoster.Common" 
             xmlns:ViewModels="clr-namespace:BloggerAutoPoster.Infrastructure.ViewModels;assembly=BloggerAutoPoster.Infrastructure" 
             mc:Ignorable="d" MinWidth="400" Background="#FF393939" FontFamily="Tahoma"
             d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <ViewModels:ConfigViewModel x:Key="vmConfigViewModel" />
    </UserControl.Resources>
    <Grid DataContext="{Binding Source={StaticResource vmConfigViewModel}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <GroupBox Margin="3" Header="Config" Grid.Column="1">
                <TabControl Margin="3">
                    <TabItem Header="General" Foreground="White" FontFamily="Tahoma" FontSize="11">
                        <Grid Margin="3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>

                            <TextBlock Text="GMail Username" Grid.Row="0" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="0" 
                                     Text="{Binding ConfigUiData.UserName, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="GMail Password" Grid.Row="1" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="1" 
                                     Text="{Binding ConfigUiData.Password, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Google+ UserIDs" Grid.Row="3" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="3" AcceptsReturn="True" MinHeight="60" MaxHeight="100" VerticalScrollBarVisibility="Visible"
                                     Text="{Binding ConfigUiData.GooglePlusUserId, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Blog Url" Grid.Row="2" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="2" 
                                     Text="{Binding ConfigUiData.BlogUrl, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Feeds To Parse" Grid.Row="4" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="4"  AcceptsReturn="True" MinHeight="60" MaxHeight="100"
                                     Text="{Binding ConfigUiData.FeedToParse, Mode=TwoWay}" VerticalScrollBarVisibility="Visible"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Post At" Grid.Row="5" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="5" 
                                     Text="{Binding ConfigUiData.PostAt, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Tags" Grid.Row="6" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="6" 
                                     Text="{Binding ConfigUiData.Tag, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Post Title" Grid.Row="7" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="7" 
                                     Text="{Binding ConfigUiData.Title, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Use Persian Date" Grid.Row="8" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <CheckBox Grid.Row="8" 
                                      IsChecked="{Binding ConfigUiData.UsePersianDate, Mode=TwoWay}"
                                      Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Read Interval (Min)" Grid.Row="9" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="9" 
                                     Text="{Binding ConfigUiData.ReadSitesDataIntervalMin, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Run At Startup" Grid.Row="10" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <CheckBox Grid.Row="10" 
                                      IsChecked="{Binding ConfigUiData.RunAtStartup, Mode=TwoWay}"
                                      Grid.Column="1" Margin="2"/>
                        </Grid>
                    </TabItem>
                    <TabItem Header="Proxy" Foreground="White" FontFamily="Tahoma" FontSize="11">
                        <Grid Margin="3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            
                            <TextBlock Text="Use proxy" Grid.Row="0" Margin="2" Grid.Column="0" VerticalAlignment="Center" />
                            <CheckBox Grid.Row="0" 
                                      IsChecked="{Binding ConfigUiData.IsProxyEnabled, Mode=TwoWay}"
                                      Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Address" Grid.Row="1" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="1" 
                                     Text="{Binding ConfigUiData.ProxyServerAddress, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Port" Grid.Row="2" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="2" 
                                     Text="{Binding ConfigUiData.ProxyServerPort, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="User name" Grid.Row="3" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="3" 
                                     Text="{Binding ConfigUiData.ProxyServerUserName, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>

                            <TextBlock Text="Password" Grid.Row="4" Grid.Column="0" Margin="2" VerticalAlignment="Center" />
                            <TextBox Grid.Row="4" 
                                     Text="{Binding ConfigUiData.ProxyServerPassword, Mode=TwoWay}"
                                     Grid.Column="1" Margin="2"/>
                        </Grid>
                    </TabItem>
                </TabControl>
            </GroupBox>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Apply" 
				Command="{Binding DoApplyConfig}"                
				Margin="3" Height="25" Width="60" />
            <Button Content="Cancel" 
					Command="{Binding DoCloseConfig}"
					Margin="3" Width="60"/>
        </StackPanel>
    </Grid>
</UserControl>
